#!/bin/sh
export SHAREDLIB_DIR="../../../../SharedLib"
rm Makefile config.cache config.h config.log config.status  stamp-h 
cp `find $PSPDEV/ -name "pspiofilemgr_dirent.h"` .
export psp=yes

echo "Creating dummy libraries so configure can finish..."
touch $SHAREDLIB_DIR/lib/libpcre.a
touch $SHAREDLIB_DIR/lib/libpng12.a
touch $SHAREDLIB_DIR/lib/libpng14.a

echo "Calling configure..."
#../configure --prefix=$(psp-config --psp-prefix) --srcdir=../ --target=psp --includedir=$PSPDEV/psp/sdk/include/ --enable-javascript --enable-graphics --without-svgalib --without-x --without-fb --without-directfb --without-pmshell --without-atheos --without-sdl --without-pspsdl --with-pspgu --with-ssl || (echo "Error configuring links2" ; exit 0);
AR="psp-ar" CC="psp-gcc" CXX="psp-g++" \
CFLAGS="-I$(psp-config --psp-prefix)/include/ -I$(psp-config --pspsdk-path)/include -I$(psp-config --psp-prefix)/include/machine/" \
LDFLAGS="-L$(psp-config --psp-prefix)/lib -L$(psp-config --pspsdk-path)/lib -L$SHAREDLIB_DIR/lib" \
LIBS="-lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -liberty -lpspsdk -lpspnet -lpspaudio -lpspgu -lpspge -lpsphprm -lpspkernel" \
../configure --target="psp" --prefix="$(psp-config --psp-prefix)" --enable-javascript --enable-graphics --without-svgalib --without-x --without-fb --without-directfb --without-pmshell --without-atheos --without-sdl --with-pspsdl --with-pspgu || (echo "Error configuring links2" ; exit 0);

#echo "include Makefile.psp" >> Makefile
echo "Done."


